﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'P_InsertContactUs')
BEGIN
	DROP  Procedure  [esf_sso].P_InsertContactUs
END
GO


CREATE Procedure [esf_sso].P_InsertContactUs
	@pApplicationCode	VARCHAR (60)
	,@pComments			VARCHAR (4000)
	,@pTitle			VARCHAR (200)
	,@pSenderEmail		VARCHAR (150)
	,@pContactUsTypeID	INT
AS
	INSERT INTO esf_sso.ContactUs
		(ID,
		ApplicationID, 
		Comments, 
		SenderEmail, 
		Title, 
		CreationDateTime,
		ContactUsTypeID) 
	SELECT
		NEWID (),
		(SELECT ID FROM [esf_sso].[VApplication] VA WHERE Code = @pApplicationCode) 
		,@pComments
		,@pSenderEmail
		,@pTitle
		,GETDATE ()
		,@pContactUsTypeID;

GO